package com.qf.controller;

import com.qf.service.DtsAddressService;
import com.qf.util.ResponseUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 收货地址
 * @author bss
 * @version V1.0
 * @Project maven
 * @Package com.qf.controller
 * @Description:
 * @Date 2022/10/16 20:13
 */
@RestController
@RequestMapping("/admin/address")
public class AdminAdressController {
//    list?page=1&limit=20&name=123&userId=1&sort=add_time&order=desc
    @Autowired
DtsAddressService addressService;
    @GetMapping("/list")
    public Object list(@RequestParam(value = "page",required = false, defaultValue = "1") Integer page,
                       @RequestParam(value = "limit",required = false, defaultValue = "20")Integer limit,
                       @RequestParam(value = "sort",required = false, defaultValue = "add_time")String sort,
                       @RequestParam(value = "order",required = false, defaultValue = "desc")String order,
                       String name, Integer userId){

        Map<String, Object> data = addressService.selectAddressByPage(page,limit,sort,order,name,userId);

        return ResponseUtil.ok(data);

    }

}
